<%

class Cls_Lang
	public data
	private s_Lang,s_path
	
	private sub class_initialize()
		s_Lang="zh-cn"
		s_path="/lang/"
		
	end sub
	
	public function init()
		dim langjs
		set langjs = new cls_json
		set data= server.createobject(ac.s_dictname)
		if ac.debug then pub.debug "加载："&s_path&s_Lang&".json"
		langjs.loadjsonfile(s_path&s_Lang&".json")
		set data=langjs.data
		set langjs=nothing
	end function
	
	'public property let E(byval s)
	'	E=data
	'end property
	public function val(byval s)
	dim temp,v,vals,len
	set temp=data
	if pub.isnul(s) then val="" : exit function
		if pub.isin(s,".") then
			vals=split(s,".")
			len=UBound(vals)
			for v=0 to len-1
				
				if temp.Exists(vals(v)) then
					set temp=temp(vals(v))
				else
					val="": exit function
				end if
			next
			val=pub.iif(temp.Exists(vals(len)),temp(vals(len)),"")
		else
			val=pub.iif(data.Exists(s),data(s),"")
		end if
	end function
	
	public property let Lang(byval s)
		s_Lang=s
	end property
	public property get Lang()
		Lang=s_Lang
	end property
	
	public property let path(byval s)
		s_path=pub.xpath(s)
	end property
	public property get path()
		path=s_path
	end property
	
end class

%>